<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/WEB-INF/pages/include/prelude.jspf"%>
<%@include file="/WEB-INF/pages/include/common.jspf"%>
<link href="<c:url value='/static/css/assignee.css' />" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="<c:url value='/static/js/validate.js'/>"></script>
<title>添加受让人</title>
<script type="text/javascript">
$(function(){
   	$("#pagetitle").html('添加受让人');
   	
   	$('#header #pageback a').attr('href', '<c:url value="/member/inAssignManager.do"/>');
    $('#header #pageback a').attr('data-ajax', 'false');
});
</script>
</head>
<body>
<div data-role="page">
	<%@include file="/WEB-INF/pages/include/header.jsp"%>
	<div data-role="content">
		<form method="post" action="<c:url value="/member/inAssignAdd.do"/>"  data-ajax="false">
		<div class="m_item">
			<ul>
				<li><div class="i_label"><span class="xh">*</span>证件类型：</div>
					<select data-role="none" name="credentialType" id="credentialType" onchange="$(this).blur()" class="txt" style="position:relative; top:-5px;">
						<c:forEach items="${credentialTypes }" var="credentialType">
							<option value="${credentialType.key }">${credentialType.value }</option>
						</c:forEach>
					</select>
					<div class="clear"></div>
				</li>
				<li><div class="i_label"><span class="xh">*</span>证件号码 ：</div><input data-role="none" id="credentialNumber" name="credentialNumber" type="text" class="txt" /><div class="clear"></div></li>
				<li><div class="i_label"><span class="xh"></span>知音卡号 ：</div><input data-role="none" id="memberNumber" name="memberNumber" type="text" class="txt" /><div class="clear"></div></li>
				<li><div class=""><span class="xh">*</span>受让人为会员，填写卡号信息，否则不用填写</div><div class="clear"></div></li>
				<li><div class="i_label"><span class="xh">*</span>名（英文）：</div><input data-role="none" id="firstName" name="firstName" type="text" class="txt" /><div class="clear"></div></li>
				<li><div class="i_label"><span class="xh">*</span>姓（英文）：</div><input data-role="none" id="lastName" name="lastName" type="text" class="txt" /><div class="clear"></div></li>
				<li><div class="i_label"><span class="xh"></span>中文名：</div><input data-role="none" id="CNFirstName" name="CNFirstName" type="text" class="txt" /><div class="clear"></div></li>
				<li><div class="i_label"><span class="xh"></span>中文姓：</div><input data-role="none" id="CNLastName" name="CNLastName" type="text" class="txt" /><div class="clear"></div></li>
				<li><div class="i_label"><span class="xh">*</span>性别：</div><input data-role="none" name="gender" type="radio" class="radio" value="M"/>男<input data-role="none" name="gender" type="radio" class="radio" value="F"/>女<div class="clear"></div></li>
		    	<li>
			      <div class="i_label"><span class="xh">*</span>生日：</div>
			      <!-- <input type="text" name="dateofBirth" placeholder="格式  yyyy-mm-dd"  data-role="none" class="txt"/> -->
 			    	<%-- <input type="text" name="birthYear" id="birthYear" placeholder="年份" class="txt" style="width: 50px;" data-role="none" onkeypress=""/>
 			    	<input type="text" name="birthMonth" id="birthMonth" placeholder="月份"  class="txt" style="width: 50px;"  data-role="none" onkeypress="return ((/[\d]/.test(String.fromCharCode(event.keyCode))) && this.value.length<2)"/>
 			    	<input type="text" name="birthDay" id="birthDay" placeholder="天数" class="txt" style="width: 50px;"  data-role="none" onkeypress="return ((/[\d]/.test(String.fromCharCode(event.keyCode))) && this.value.length<2)"/> --%>
 			    	
 			    	<select data-role="none" class="txt t5" name="birthYear" id="birthYear" style="position:relative;top:-3px; width: 20%;">
						<option>年</option>
						<%for(int i=2013;i>1920;i--){ %>
						<option value="<%=i%>"><%=i%></option>
						<%}%>
					</select>
			    	<select data-role="none" class="txt t5" name="birthMonth" id="birthMonth" style="position:relative;top:-3px; width: 20%;">
			    		<option>月</option>
			    		<%for(int i=1;i<13;i++){ String no="01"; if(i<10){no = "0"+i;}else{no = i+"";} %>
						<option value="<%=no%>"><%=no%></option>
						<%}%>
			    	</select>
			    	<select data-role="none" class="txt t5" name="birthDay" id="birthDay" style="position:relative;top:-3px; width: 20%;">
			    		<option>日</option>
			    		<%for(int i=1;i<32;i++){ String no="01"; if(i<10){no = "0"+i;}else{no = i+"";} %>
						<option value="<%=no%>"><%=no%></option>
						<%}%>
			    	</select>
 			      <div class="clear"></div>
		    	</li>
		    </ul>
		</div>
		<br />
		<div><input type="submit" class="btn" data-theme="a" value="添加" onclick="return validateForm();"></input></div>
		</form>
		
		<script type="text/javascript">
			function validateForm(){
				if(!IsNull('credentialNumber', '证件号码')){
					return false;
				}
				
				if(!IsNull('firstName', '英文名')){
					return false;
				}
				
				if(!IsNull('lastName', '英文姓')){
					return false;
				}
				
				if(!IsNull('birthYear', '生日年份')){
					return false;
				}
				var valBirthYear = document.getElementById('birthYear').value;
				if( isNaN(valBirthYear) || valBirthYear.length!=4 || parseInt(valBirthYear) > 3000 || parseInt(valBirthYear) < 1000){
					alert('请输入合法的生日年份');
					return false;
				}
				
				if(!IsNull('birthMonth', '生日月份')){
					return false;
				}
				var valBirthMonth = document.getElementById('birthMonth').value;
				if(isNaN(valBirthMonth) || valBirthMonth.length>2 || parseInt(valBirthMonth) > 12 || parseInt(valBirthMonth) < 1){
					alert('请输入合法的生日月份');
					return false;
				}
				
				
				if(!IsNull('birthDay', '生日天数')){
					return false;
				}
				var valBirthDay = document.getElementById('birthDay').value;
				if( isNaN(valBirthDay) || valBirthDay.length>2 || parseInt(valBirthDay) > 31 || parseInt(valBirthDay) < 1){
					alert('请输入合法的生日天数');
					return false;
				}
			}
		</script>
	</div>
</div>
</body>
</html>